Exporting targets of a project

SNiFF+'s Make Support provides a mechanism for automatically linking the targets of a project to its superproject. When you use this mechanism, SNiFF+ automatically enters and maintains the necessary link commands in Project Makefiles, thus saving you from having to do this yourself.
A project can export its target to its superproject. The superproject can then either link these targets to its own targets during a build, or export them to its own superproject.
The following types of targets can be exported:

- relinkable object
- library
- object file (for the purposes of this section, all object files built in a project are collectively considered to be a single target)

Although an exported target need not be the default project of a target, it is good practice that it is.
The following examples show how exporting targets works:
Example 1

The project

prj.shared in the above illustration has two subprojects: libX.shared and libY.shared . Library targets are built in both subprojects and are then exported (passed) to prj.shared .
prj.shared imports (receives) the two library targets from its subprojects. These library targets are linked to prj.shared 's own target, demo.o (a relinkable object).
Example 2
Now suppose prj.shared from Example 1 is itself a subproject of another project, root.shared , in which the executable exec is built. prj.shared exports its relinkable object and the two libraries exported from its subprojects to root.shared . This is shown in the following illustration:

Several more export scenarios are possible in SNiFF+. These are explained in detail in the section that covers Make Support setup later on in this chapter on page 110.